package com.pattern.proxy;

import org.springframework.cglib.proxy.MethodInterceptor;
import org.springframework.cglib.proxy.MethodProxy;

import java.lang.reflect.Method;

/**
 * @Description: 拦截器
 * @Author: whp
 * @Date: 2021-01-28 13:43
 */
public class MyMethodIntercetor implements MethodInterceptor {
    @Override
    public Object intercept(Object o, Method method, Object[] objects, MethodProxy methodProxy) throws Throwable {
        System.out.println("目标类增强--before");
        Object obj= methodProxy.invokeSuper(o,objects);
        System.out.println("目标类增强--alter");
        return obj;
    }
}
